package com.canvas.web.controller;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author: 宗恣
 * @Date: 2018/8/29 0029 13:07
 */
@Controller
public class HomeController {

    @GetMapping(value = {"/", "/index"})
    public String test(Model model) {
        return "index";
    }

    @GetMapping("/404")
    public String notFoundPage() {
        return "404";
    }

    @GetMapping("/403")
    public String accessError() {
        return "403";
    }

    @GetMapping("/500")
    public String internalError() {
        return "500";
    }

    @GetMapping("/logout/page")
    public String logoutPage() {
        return "logout";
    }

    @GetMapping("/test")
    @ResponseBody
    public String test() {

        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();

        String s = "123";

        String s1 = bCryptPasswordEncoder.encode(s);

        System.out.println(s1);

        return s1;
    }

}
